<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" >

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>H+ 后台主题UI框架 - 登录</title>
    <meta name="keywords" content="H+后台主题,后台bootstrap框架,会员中心主题,后台HTML,响应式后台">
    <meta name="description" content="H+是一个完全响应式，基于Bootstrap3最新版本开发的扁平化主题，她采用了主流的左右两栏式布局，使用了Html5+CSS3等现代技术">

    <link rel="shortcut icon" href="favicon.ico">
    <link href="../static/css/bootstrap.min.css?v=3.3.6" th:href="@{/css/bootstrap.min.css}"  rel="stylesheet">
    <link href="../static/css/font-awesome.css?v=4.4.0" th:href="@{/css/font-awesome.css}" rel="stylesheet">

    <link href="../static/css/animate.css" th:href="@{/css/animate.css}" rel="stylesheet">
    <link href="../static/css/style.css?v=4.1.0" th:href="@{/css/style.css}" rel="stylesheet">
    <!--[if lt IE 9]>
    <meta http-equiv="refresh" content="0;ie.html" />
    <![endif]-->
    <script>if(window.top !== window.self){ window.top.location = window.location;}</script>
</head>

<body class="gray-bg">

    <div class="middle-box text-center loginscreen  animated fadeInDown">
        <div>
            <div>

                <h1 class="logo-name">H+</h1>

            </div>
            <h3>欢迎使用 H+</h3>

            <form class="m-t" role="form" id="loginForm"  method="post">
                <div class="form-group">
                    <input name="username" class="form-control" placeholder="用户名" required="required">
                </div>
                <div class="form-group">
                    <input type="password" name="password" class="form-control" placeholder="密码" required="required">
                </div>
                <button type="button" class="btn btn-primary block full-width m-b" onclick="dologin();">登 录</button>

                <p class="text-muted text-center"> <a href="login.html#"><small>忘记密码了？</small></a> | <a href="register.html">注册一个新账号</a>
                </p>

            </form>
        </div>
    </div>

    <!-- 全局js -->
    <script src="../static/js/jquery.min.js?v=2.1.4" th:src="@{/js/jquery.min.js}"></script>
    <script src="../static/js/bootstrap.min.js?v=3.3.6" th:src="@{/js/bootstrap.min.js}"></script>
    <script src="../../static/js/plugins/layer/layer.min.js" th:src="@{/js/plugins/layer/layer.min.js}"></script>
    <script type="text/javascript">
        function dologin() {
            if($("[name=username]").val()==""){
                layer.msg("请输入用户名或邮箱",{icon:6,time:1000});
            }else if($("[name=password]").val()==""){
                layer.msg("请输入密码",{icon:6,time:1000});
            }else{
                $.ajax({
                    type: "POST",dataType: "JSON",
                    url:"/loginUser",
                    data: $("#loginForm").serialize(),
                    async : false,
                    success: function(data){
                        if(data.success){
                           window.location.href="/indexpage";
                        }else{
                            layer.msg(data.msg,{icon:2,time:1000});
                        }
                    }
                });
            }

        }
    </script>
</body>

</html>
